<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>盒子内外边距</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      .box {
        width: 300px;
        height: 400px;
        background-color: red;

        /* 内边距 */
        /* padding: 20px; */
        /* padding: 20px 40px; */
        /* padding: 10px 20px 30px 40px; */
        /* padding-top: 40px; */

        /* 尺寸模式 */
        /* box-sizing: content-box; */
        box-sizing: border-box;
        /* 外边距 */
        margin: 20px;
      }
      .box1 {
        width: 600px;
        height: 800px;
        background-color: aqua;
      }
    </style>
  </head>
  <body>
    <div class="box1"><div class="box">盒子内外边距</div></div>
  </body>
</html>
